using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using FutureOpen.Core;
using FutureOpen.Core.func;
using FutureOpen.Core.func.db;
using FutureOpen.Core.func.sql;
using System.Collections.Generic;
using FutureOpen.Core.func.util;

public partial class Pages_Mail : FutureOpen.Web.Pages.PageBase
{
    public int msg_count;
    //MyUsr myusr = new MyUsr();
    protected void Page_Load(object sender, EventArgs e)
    {
        base.PageInit();
      
        if (!IsPostBack)
        {
            AspNetPager1.RecordCount = MailProvider.GetRecieveMSGCount(MyUsr, MailProvider.MsgType_Letter);
            msg_count = AspNetPager1.RecordCount;
            BindMsgs(0, 10);
        }
    }

    private void BindMsgs(int start, int count)
    {
        DataSet ds = MailProvider.GetRecieveMSG(MyUsr, MailProvider.MsgType_Letter, start, count);
        DataList1.DataSource = ds.Tables[0];
        DataList1.DataBind();       
    }   

    protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
        AspNetPager1.CurrentPageIndex = e.NewPageIndex;
        BindMsgs((e.NewPageIndex - 1) * 10, 10);
    }

    public string GetMsg(object obj)
    {
        return StringUtil.ShortenStr(obj.ToString());
    }
    
}
